import { createApp } from 'vue'
import Dev from './serve.vue'
import WdComponentsDemo from '@/entry.esm'
import '../styles/index.scss'
import { Button, Layout, Dropdown, Menu, Tooltip, Spin, Row, Col, Pagination, Drawer, Form, Badge, DatePicker, Input, Select, Checkbox, Modal, Collapse, Radio, Cascader, TreeSelect, Tabs, Tree, Tag, InputNumber } from 'ant-design-vue'
import {
  Header,
  Column,
  Table,
  Grid,
  Toolbar,
  Filter,
  Tooltip as VxeTooltip,
  Icon as vxeIcon,
  Button as VxeButton,
  Select as VxeSelect,
  Modal as vxeModal,
  Pager as VxePager,
  Input as vxeInput
  , VXETable
} from 'vxe-table'
import zhCN from 'vxe-table/es/locale/lang/zh-CN'
import XEUtils from 'xe-utils'
const app = createApp(Dev)
VXETable.setup({
  i18n: (key: any, args: any) => XEUtils.toFormatString(XEUtils.get(zhCN, key), args)
})
export const registerAntdComponents: any = (app: any): void => {
  app.use(Button)
  app.use(Menu)
  app.use(Layout)
  app.use(Spin)
  // app.use(Icon)
  app.use(Row)
  app.use(Col)
  app.use(Pagination)
  app.use(Form)
  app.use(Dropdown)
  app.use(Input)
  app.use(Tree)
  app.use(Radio)
  app.use(Select)
  app.use(Checkbox)
  app.use(Modal)
  app.use(Collapse)
  app.use(Cascader)
  app.use(TreeSelect)
  app.use(DatePicker)
  app.use(Tabs)
  app.use(Tag)
  app.use(Badge)
  app.use(Drawer)
  app.use(InputNumber)
  app.use(Tooltip)

  // ------------------------------------------------------------------------------
  app.use(vxeIcon)
  app.use(Header)
  app.use(Column)
  app.use(Table)
  app.use(Grid)
  app.use(Toolbar)
  app.use(VxeTooltip)
  app.use(VxeButton)
  app.use(vxeModal)
  app.use(vxeInput)
  app.use(VxePager)
  app.use(VxeSelect)
  app.use(Filter)
  app.use(VxePager)
}
registerAntdComponents(app)
app.use(WdComponentsDemo)
app.mount('#app')
app.config.globalProperties.$app = app
const scriptElement = document.createElement('script')
document.body.appendChild(scriptElement)
scriptElement.src = '//at.alicdn.com/t/font_2507002_66gvxb4439u.js'
